<template>
  <select-scroll v-model="entrustOrganization" filterable clearable
                  valueKey="entrustOrganizationId"
                  :filter-method="listeningEvent"
                  label-key="organizationName"
                  query-key="organizationName"
                  :deft="deft">
  </select-scroll>
</template>

<script>
  import { entrustOrganizationList } from "@/api/person/entrustOrganization";
  export default{
    name : 'entrustSelect',
    data(){
      return{
      }
    },
    props:['eid','name', 'deft'],
    computed:{
      entrustOrganization:{
        get(){
          if(this.eid ){
            return {
              entrustOrganizationId:this.eid,
              organizationName:this.name
            }
          }else{
            return null
          }
        },
        set(val){
          this.$emit("update:eid",val.entrustOrganizationId)
          this.$emit("update:name",val.organizationName)
          this.$emit('change',val)
        }
      }
    },
    methods:{
      // 获取单位下拉框
      listeningEvent(e) {
        return entrustOrganizationList(e)
      },
    },
  }
</script>

<style>
</style>
